const api = require('../../utils/api.js');

Page({
  data: {
  },
  onLoad() {
    this.setData({ imgBaseUrl: api.ENV.imgBaseUrl || '' });
  },
  onSignUp: function () {
    // 立即报名按钮点击事件
    wx.showModal({
      title: '报名提示',
      content: '确定要报名参加"重走652之路"校史研学实践活动吗？',
      success: (res) => {
        if (res.confirm) {
          wx.showToast({
            title: '报名成功',
            icon: 'success',
            duration: 2000
          })
        }
      }
    })
  },

  onActivityTap: function (e) {
    // 点击往期活动的事件
    const index = e.currentTarget.dataset.index
    const activities = [
      {
        name: '社区志愿服务——传承奉献精神',
        date: '2023.09'
      },
      {
        name: '校企合作实践——践行创新精神',
        date: '2023.06'
      }
    ]
    
    wx.showModal({
      title: activities[index].name,
      content: `活动日期: ${activities[index].date}`,
      showCancel: false,
      confirmText: '我知道了'
    })
  }
})